DevForce Help Reference
Sum<TSource>(IEntityScalarQuery<TSource>,CancellationToken) Method
Example 


Computes the sum of a sequence of numeric values. Pass in a System.Threading.CancellationToken to cancel operation.
Syntax
'Declaration
 
<ExtensionAttribute()>
Public Overloads Shared Function Sum(Of TSource)( _
   ByVal source As IEntityScalarQuery(Of TSource), _
   ByVal cancellationToken As CancellationToken _
) As Task(Of TSource)
'Usage
 
Dim source As IEntityScalarQuery(Of TSource)
Dim cancellationToken As CancellationToken
Dim value As Task(Of TSource)
 
value = EntityScalarAsyncExtensions.Sum(Of TSource)(source, cancellationToken)

Parameters

source
cancellationToken

Type Parameters

TSource
Example
public async void AsyncSum() {
   var sumFreight = await _entityManager.OrderSummaries.Select(o => o.Freight).AsScalarAsync().Sum();
 }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EntityScalarAsyncExtensions Class
EntityScalarAsyncExtensions Members
Overload List

Send Feedback